Socket
Socket
Sign inDemoInstall

multikey-map

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multikey-map

Multikey Map


Version published
Weekly downloads
1.4K
increased by12.59%
Maintainers
1
Weekly downloads
 
Created
Source

NPM Package

Multikey Map

A simple map implementation that supports multiple keys, using ES6 Map and WeakMap internally.

Installation

yarn add multikey-map
# or
npm install multikey-map --save

Usage

import MultikeyMap from 'multikey-map';

let map = new MultikeyMap<[string, number], string | undefined>();

map.set(['foo', 0], 'a');
map.set(['foo', 1], 'b');

map.get(['foo', 0]); // 'a'
map.get(['foo', 1]); // 'b'
map.get(['foo', 2]); // undefined
map.has(['foo', 2]); // false
map.hasAndGet(['foo', 2]); // [false, undefined]

map.set(['bar', 0], undefined);

map.get(['bar', 0]); // undefined
map.has(['bar', 0]); // true
map.hasAndGet(['bar', 0]); // [true, undefined]

let weakMap = new MultikeyMap<[object, object], number | undefined>(true);

License

MIT License.

FAQs

Package last updated on 07 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc